<template>
  <div class="container">
      <MusicItem v-for="item of mores" :item="item" :key="item.id"></MusicItem>
  </div>
</template>

<script>
import MusicItem from "../../components/music/MuiscItem.vue";
import HomeHttp from '../../models/HomeHttp'
export default {
    data(){
        return{
            mores:[]
        }
    },
    components:{
        MusicItem
    },
    async activated(){
        var {value} = this.$route.query;
        var fn  = this.hanldeQuery(value);
        var res = await HomeHttp[fn]();
        var {playlists,result,albums} = res.data;
        if(playlists){
            this.mores = playlists
        }else if(albums){
            this.mores = albums
        }else if(result){
            this.mores = result
        }
    },
    methods:{
        hanldeQuery(value){
            if(value == "hots"){
                return "getHotMusic"
            }else if(value == "news"){
                return "getNewMusic"
            }else if(value == "djs"){
                return "getDj"
            }
        }
    }
}
</script>

<style>

</style>